package cn.psvmc.cxzapi.controller.customer;

import cn.psvmc.cxzapi.constant.GlobalConstant;
import cn.psvmc.cxzapi.response.Result;
import cn.psvmc.cxzapi.response.ResultGenerator;
import cn.psvmc.cxzapi.service.customer.TCustomerMessageService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author ywx
 * @className TCustomerMessageController
 * @description 消息订阅
 * @date 2024/12/18 21:35
 **/
@RestController
@RequestMapping("/mpapi/customer_message")
public class TCustomerMessageController {
    @Resource
    private TCustomerMessageService tCustomerMessageService;

    /**
     * @Description 查询消息订阅关系
     * @Date 2024/12/18 21:51
     * @Author YWX
     * @Param [request, templateIds]
     * @Return cn.psvmc.cxzapi.response.Result
     **/
    @PostMapping("/ms_query")
    public Result messagetemplateSubscribeQuery(HttpServletRequest request, @RequestBody List<String> templateIds) {
        int userid = request.getIntHeader(GlobalConstant.USRID);
        return ResultGenerator.genSuccessResult("查询成功！", tCustomerMessageService.queryMessageTemplateSubscribe(userid, templateIds));
    }

    /**
     * @Description 活动领取咨询
     * @Date 2025/1/4 0:20
     * @Author YWX
     * @Param [request]
     * @Return cn.psvmc.cxzapi.response.Result
     **/
    @PostMapping("/activity_consult")
    public Result activityConsult(HttpServletRequest request) {
        int userid = request.getIntHeader(GlobalConstant.USRID);
        return ResultGenerator.genSuccessResult("查询成功！", tCustomerMessageService.activityConsult(userid));
    }
}
